<?php


	namespace app\services;


	use OSS\OssClient;
	use think\facade\Config;

	class AliOssServices
	{

		protected $accessKeyId;
		protected $accessKeySecret;
		protected $endpoint;
		protected $bucket;

		public function __construct () {
			$this->accessKeyId = Config::get('alioss.accessKeyId');
			$this->accessKeySecret = Config::get('alioss.accessKeySecret');
			$this->endpoint = Config::get('alioss.endPoint');
			$this->bucket = Config::get('alioss.bucket');
		}

		public function upload($video,$txt = 'mp4',$folder='upload/'){
			$filename = $folder.date('YmdHis').random(6).'.'.$txt;
			$oss = new OssClient($this->accessKeyId,$this->accessKeySecret,$this->endpoint);
			$ret = $oss->uploadFile($this->bucket,$filename,$video);

			return $ret;
		}

		public function ossUpload($video,$txt = 'mp4',$folder = ''){

		}


	}
